package com.cjz.roomdbdemo.db;

import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;

/**
 * 笔记实体类，通过注解与数据库表绑定
 * <p>
 * Created by cjz on 2018/8/31.
 */
@Entity(tableName = NoteDAO.tableName)
public class Note {

    @PrimaryKey(autoGenerate = true)
    @ColumnInfo
    private long id;

    @NonNull
    @ColumnInfo
    private String note;

    @ColumnInfo
    private long insertTime;

    public Note(@NonNull String note) {
        this.note = note;
        this.insertTime = System.currentTimeMillis();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @NonNull
    public String getNote() {
        return note;
    }

    public void setNote(@NonNull String note) {
        this.note = note;
    }

    public long getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(long insertTime) {
        this.insertTime = insertTime;
    }
}
